<% layout('/layouts/default.html', {title: '文件销毁任务管理', libs: ['validate']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header with-border">
			<div class="box-title">
				<i class="fa icon-note"></i> ${text(docDestroyTask.isNewRecord ? '新增文件销毁任务' : '编辑文件销毁任务')}
			</div>
			<div class="box-tools pull-right">
				<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
			</div>
		</div>
		<#form:form id="inputForm" model="${docDestroyTask}" action="${ctx}/sd/docDestroyTask/save" method="post" class="form-horizontal">
			<div class="box-body">
				<div class="form-unit">${text('基本信息')}</div>
				<#form:hidden path="id"/>
				<div class="row">
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required ">*</span> ${text('任务名称')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-5">
								<#form:input path="taskName" maxlength="100" class="form-control required"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
				<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required ">*</span> ${text('销毁日期')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-5">
								<#form:input path="destroyDate" readonly="true" maxlength="20" class="form-control "
									dataFormat="datetime" defaultValue="${date()}" data-type="datetime" data-format="yyyy-MM-dd HH:mm"/>
							</div>
						</div>
				</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required ">*</span> ${text('销毁操作人')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-5">
								<#form:treeselect id="destroyUserCode" title="${text('用户选择')}"
									path="destroyUser.userCode" labelPath="destroyUser.userName"
									url="${ctx}/sys/office/treeData?isLoadUser=true"
									class=" required" allowClear="true" callbackFuncName="check"/>
							</div>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-xs-12">
						<div class="form-group">
							<label class="control-label col-sm-2" title="">
								<span class="required ">*</span> ${text('监销人')}：<i class="fa icon-question hide"></i></label>
							<div class="col-sm-5">
								<#form:treeselect id="destoyCheckUserCode" title="${text('用户选择')}"
									path="destoyCheckUser.userCode" labelPath="destoyCheckUser.userName"
									url="${ctx}/sys/office/treeData?isLoadUser=true"
									class=" required" allowClear="true" callbackFuncName="check"/>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="box-footer">
				<div class="row">
					<div class="col-sm-offset-2 col-sm-10">
						<% if (hasPermi('sd:docDestroyTask:edit')){ %>
							<button type="submit" class="btn btn-sm btn-primary" id="btnSubmit"><i class="fa fa-check"></i> ${text('保 存')}</button>&nbsp;
						<% } %>
						<button type="button" class="btn btn-sm btn-default" id="btnCancel" onclick="js.closeCurrentTabPage()"><i class="fa fa-reply-all"></i> ${text('关 闭')}</button>
					</div>
				</div>
			</div>
		</#form:form>
	</div>
</div>
<% } %>
<script>
	var testUser1;
	var testUser;
	function check(id, act, index, layero, nodes){

		if (id == 'destroyUserCode' && (act == 'ok' || act == 'clear')){
			var win = layero.iframeWindow();
			testUser1=nodes[0].id;
			console.log(nodes[0].id)
		}
		if (id == 'destoyCheckUserCode' && (act == 'ok' || act == 'clear')){
			var win = layero.iframeWindow();
			testUser=nodes[0].id;

		}
		console.log(testUser1)
		console.log(testUser)
		if(testUser1!="undefined"&&testUser!="undefined"){
			if (testUser1==testUser){
				testUser1="undefined";
				testUser="undefined";
				$("#destroyUserCode").val("");
				$("#destroyUserCodeName").val("");
				$("#destoyCheckUserCode").val("");
				$("#destoyCheckUserCodeName").val("");
				js.layer.msg("不能是同一人",{icon:5})
			}
		}
	}
$("#inputForm").validate({
	submitHandler: function(form){
		js.ajaxSubmitForm($(form), function(data){
			js.showMessage(data.message);
			if(data.result == Global.TRUE){
				js.closeCurrentTabPage(function(contentWindow){
					contentWindow.page();
				});
			}
		}, "json");
    }
});
</script>